import Vue from 'vue'
import Router from 'vue-router'
import Login from "../views/Login";
import Blog from "../views/Blog";
import BlogEdit from "../views/BlogEdit";
import BlogDetail from "../views/BlogDetail";
Vue.use(Router)

export default new Router({
  mode:'history',
  routes: [
    {
      path:"/",
      name: "index",
      redirect: {name: "blog"}
    },
    {
      path:"/blog",
      name: "blog",
      component:Blog
    },
    {
      path:"/login",
      name: "login",
      component: Login
    },
    {
      path:'/blog/add',
      name: "add",
      component: BlogEdit,
      meta:{
        requireAuth: true
      }
    },
    {
      path:"/blog/:blogId",
      name: "detail",
      component: BlogDetail
    },
    {
      path:"/blog/:blogId/edit",
      name: "edit",
      component: BlogEdit,
      meta:{
        requireAuth: true
      }
    }
  ]
})

